<template>
	<!-- 文章列表 -->
	<view>
		<uni-nav-bar left-icon="back" :title="title" color="#fff" fixed="true" statusBar="true" backgroundColor="#F22F29" @clickLeft="fnGoBack()"></uni-nav-bar>
		<view class="list">
			<view class="flex-bc moreItem" v-for="(item,index) in articleList" :key="index" @click="fnToArticleDetail(item.article_id,item.title)">
				<text>{{item.title}}</text>
				<uni-icons type="arrowright" size="14" color="#e3e3e3"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	export default {
		components: {
			uniNavBar
		},
		data() {
			return {
				title:'',
				type_id:'',
				articleList:[],
				page:1,
				row:10
			};
		},
		onLoad(option) {
			console.log(option)
			this.title = option.name
			this.type_id = option.id
		},
		onShow() {
			this.fnGetArticleList()
		},
		methods:{
			fnGoBack(){
				uni.navigateBack()
			},
			fnGetArticleList(){
				console.log(this.type_id)
				this.request({
					url: '/czb/help_center/getArticleList',
					method: 'POST',
					data: {
						'store_id': 1,
						'page':this.page,
						'row':this.row,
						'type_id':this.type_id
					},
				}).then((ret) => {
					console.log(ret);
					if (ret.code == 0) {
						this.articleList = ret.data
					}
				})
			},
			fnToArticleDetail(id,title){
				uni.navigateTo({
					url:`../articleDetail/articleDetail?id=${id}&title=${title}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #fff;
	}
	.moreItem {
		height: 100rpx;
		padding: 0 20rpx;
		font-size: 30rpx;
		border-bottom: 1rpx solid #e3e3e3;
	}
</style>
